#ifndef __ZSTRING_H__
#define __ZSTRING_H__

#include <string>
#include "Poco/LocalDateTime.h"
#include <stdint.h>

class StringUtil
{
public:
    enum DATE_FMT
    {
        DATE_FMT_NORMAL,
        DATE_FMT_LOG,
        DATE_FMT_LOG_FILENAME,
    };
    static std::string Date2String(DATE_FMT fmt = DATE_FMT_NORMAL);
    static std::string Date2String(Poco::LocalDateTime dt, DATE_FMT fmt = DATE_FMT_NORMAL);
    static std::string Int2String(int i);
    static std::string HexFormat(const char* buf, int iLen);
    static int String2Int(std::string s);
    static bool String2Int(std::string s, int& i);
    static int String2Hex(std::string s);
    static std::string Char2String(const char* c);
    static int Char2Int(const char* c);

    static bool IsAllSpace(const std::string &str);

public:
    static void RemoveSubString(std::string& strSrc, std::string strSubStr);
    static void StringReplace(std::string& str, std::string strSrc, std::string strDst);

public:
    static bool IsIP(std::string strIP);

public:
    static int GetValueByKey(const std::string &s, const std::string &key, std::string &value, const std::string &endID);

public:
    static std::string Hex2String(unsigned char c);
    static char HarfHex2Byte(unsigned char hh);
};

#endif //__ZSTRING_H__